package org.vogelsk.blue.objects;

/**
 * 
 * Class for the ball.
 * 
 * @author dejan.dosic
 *
 */

public class Ball extends GenericCreature{


	private boolean active;
	
	public Ball( double x, double y, double d, boolean active) {
		super(1, 1, x, y, d, false);
		this.active = active;

	}
	public Ball( double x, double y, double speed, boolean active, double angle) {
		super(1, 1, x, y, speed, false);
		this.active = active;
		setAngle(angle);
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}
	
	@Override
	public boolean isGoingDown(){
		return Math.sin(Math.toRadians(getAngle()))>0;
	}
	
	@Override
	public boolean isGoingRight(){
		return Math.cos(Math.toRadians(getAngle()))>0;
	}
	@Override
	public void move() {
		if (active){
		setX(getX() + ((Math.cos(Math.toRadians(getAngle())) * getSpeed())));
		setY(getY() + ((Math.sin(Math.toRadians(getAngle())) * getSpeed())));
		}
	}

}
